package com.pz.cloud.framework.base.aspect;

import com.pz.cloud.framework.base.model.WorkflowEntity;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;
/**
 * 业务权限切面 针对数据范围 与dao的BizUtil.assembleAuthSql(sql,params,entity,"t")搭配使用
 * @author 3hmzz
 */
@Aspect
@Component
public class BizAuthAspect {

    @Around("@annotation(com.pz.cloud.framework.base.annotation.BizAuth)")
    public Object setValue(ProceedingJoinPoint joinPoint) throws Throwable {
        Object[] args = joinPoint.getArgs();
        for (Object arg : args) {
            if(arg instanceof WorkflowEntity){
                WorkflowEntity entity = (WorkflowEntity)arg;
//                BizAuthModel bizAuthModel = entity.getBizAuthModel();
//                if(bizAuthModel==null){
//                    bizAuthModel = new BizAuthModel();
//                }
//                bizAuthModel.setIsFilter(true);
            }
        }
        Object result = joinPoint.proceed();
        return result;
    }

}
